#include <stdio.h>
#include "string.h"
int BF(char *A,char *B) {
    int i = 0,j = 0;
    while (i < strlen(A) && j < strlen(B)) {
        if(A[i] == B[j]) {
            i++;
            j++;
        } else {
            i = i - j + 1;
            j = 0;
        }
    }
    if(j == strlen(B)) {
        return i- strlen(B) + 1;
    }
    return 0;
}

int main() {
    int count = BF("abcdfabcgd","dfab");
    printf("%d",count);
    return 0;
}
